package com.hnjz.sys.log;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hnjz.common.FyWebResult;
import com.hnjz.common.JsonResultUtil;

@Controller
public class LoggerController {

	private static final Log log=LogFactory.getLog(LoggerController.class);
	
	@Autowired
	private LoggerManager loggerManager;
	
	@RequestMapping(value="/loggerList.htm")
	public String loggerList(ModelMap model){
		return "sys/log/loggerList";
	}
	
	/**
	 * 查询日志管理
	 * @param model
	 * @param userName
	 * @param type
	 * @param url
	 * @param createtime
	 * @param page
	 * @param pageSize
	 */
	@RequestMapping(value="/loggerQuery.json",produces="application/json")
	public void loggerQuery(ModelMap model,String userName,String type,String url,String createtime,String page,String pageSize) {
		page=StringUtils.defaultIfBlank(page, "1");
		FyWebResult re=loggerManager.queryLogger(userName, type, url, createtime, page, pageSize);
		JsonResultUtil.fyWeb(model, re);
	}
}
